#!/usr/bin/python
import os.path
import imp
import sys
from time import sleep
import argparse

inputpath = os.path.join(os.path.dirname(imp.find_module("upmd")[1]), "inputs/")
if not inputpath in sys.path:
    sys.path.append(inputpath)
    
sourcepath = os.path.join(os.path.dirname(imp.find_module("upmd")[1]), "sources/")
if not sourcepath in sys.path:
    sys.path.append(sourcepath)

parser = argparse.ArgumentParser(description='Program for ripping music from many sources.')
parser.add_argument('-i', '--input', action="store", dest="input", type=str, required = True, help="The input type to retrieve a list of songs from.")
parser.add_argument('-io', '--input-options', action="store", dest="inputopt", type=str, default=0, help="Any options needed to be passed to input module.")
parser.add_argument('-s', '--source', action="store", dest="source", type=str, required = True, help="The source to use for downloading songs.")
parser.add_argument('-so', '--source-options', action="store", dest="sourceopt", type=str, default=0, help="Any options needed to be passed to source module.")
variables = parser.parse_args()

try:
	inputmodule = __import__(variables.input)
	sourcemodule = __import__(variables.source)
except ImportError:
	print "module doesn't exist"
	
inputlist = inputmodule.inputlist(variables.inputopt)
source = sourcemodule.source(variables.sourceopt)

while not inputlist.empty():
	print 'hello'
